package dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import pojo.ClazzM;

import java.util.List;

@Component
public interface ClazzMapper {

    @Select("select * from class_m")
    List<ClazzM> getAll();

    @Select("select * from class_m where clazz = #{clazz}")
    ClazzM getOne(int clazz);

    @Update("update class_m set grade=#{grade},classroom=#{classroom},year=#{year},profession=#{profession},master=#{master},remark=#{remark} where clazz = #{clazz}")
    Integer update(ClazzM clazz);

    @Delete("delete from class_m where id = #{id}")
    Integer del(String id);

    @Insert("INSERT INTO class_m (id,grade,clazz,classroom,year,profession,master,remark) VALUES (#{id},#{grade},#{clazz},#{classroom},#{year},#{profession},#{master},#{remark})")
    Integer add(ClazzM clazzM);

}
